﻿using System;
using ExFlash.Records;

namespace ExFlash.Tags
{
    public class ImportAssets2Tag : ImportAssetsTag
    {
        public ImportAssets2Tag(int len, int version, Int32 offset)
            : base(TagCodes.ImportAssets2,len,version,offset)
        {
        }

        public override void SwfDeserialize(BinaryBitReader reader)
        {
            URL = new StringRecord(SwfVersion);
            URL.SwfDeserialize(reader);
            
            // Reserved
            reader.Position += 2;

            Count = reader.ReadUInt16();

            Assets = new AssetData[Count];

            for (int i = 0; i < Count; i++)
            {
                Assets[i] = new AssetData(SwfVersion);
                Assets[i].SwfDeserialize(reader);
            }
        }

        public override void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }
    }
}
